<?php
//订单模型
namespace Mobile\Model;
use Think\Model;

/**
 * 模型
 */
class orderModel extends Model{
    
    protected $tableName = 'order';

    /**
     * 自动完成
     * @var array
     */
    protected $_auto = array(
    );


    /*
     * 自动验证
     */
    protected $_validate = array(
     );
    
    /*
     * 获取列表
     */
    public function getOrderList($where,$page){
        $res = $this->where($where)->order("order_id DESC")->page($page,10)->select();
        return $res;
    }
    
    /*
     * 获取列表
     */
    public function getOrderLists($where){
        $res = $this->where($where)->select();
        return $res;
    }
    
    /*
     * 统计数量
     */
    public function getOrderCount($where){
        $res = $this->where($where)->count();
        return $res;
    }
    
    /*
     * 添加
     */
    public function addOrder($data){
        $res = $this->add($data);
        return $res;
    }
    
    /*
     * 获取信息
     */
    public function getOrder($where){
        $res = $this->where($where)->find();
        return $res;
    }
	
    /*
     * 编辑信息
     */
    public function editOrder($where,$data){
        return $this->where($where)->save($data);
    }
    
    /*
     * 计算上月的业绩
     * 订单类型0注册，1重消 2升级
     */
    public function sumYeji($where){
   
        $res = $this->where($where)->sum('order_cashmoney');
        return $res;
    
    }
}
